From: Mario Sanchez Prada Date: Fri, 30 Jun 2017 01:22:42 +0000 (+0000) Subject: dnd: Prevent dividing by zero when calculating the scale factor X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~48 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=703187e99620de085978954fe3a3004676de1046;p=gnome-shell.git dnd: Prevent dividing by zero when calculating the scale factor This ensures that we snap back to the correct size when the source actor has been scaled to 0. https://bugzilla.gnome.org/show_bug.cgi?id=787901 --- diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 64c1eb51b..a64915bc8 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -531,7 +531,7 @@ var _Draggable = new Lang.Class({ // Snap the clone back to its source [x, y] = this._dragActorSource.get_transformed_position(); let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size(); - scale = this._dragActor.width / sourceScaledWidth; + scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0; } else if (this._dragOrigParent) { // Snap the actor back to its original position within // its parent, adjusting for the fact that the parent